const express = require("express");
const app = express();
const port = 8080;

const users = [{username:'admin',password:'password123'},{username:'admin2',password:'1234'}];
app.get("/login",(req,res)=>{

    let user = user.find(u=> u.username == req.query.uname&&u.password ==req.query.upwd);
    if(user){
        res.json({code:200,msg:"登录成功"});
    }else{
        res.json({code:401,mag:"用户名或密码错误"});
    }
});
app.listen(port,()=>{
    console.log("监听端口" + port);
});